home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / tools / SimpleJavaFileObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  2.5 KB  |  100 lines

  1. package javax.tools;
  2.  
  3. import java.io.CharArrayReader;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.io.OutputStream;
  7. import java.io.OutputStreamWriter;
  8. import java.io.Reader;
  9. import java.io.StringReader;
  10. import java.io.Writer;
  11. import java.net.URI;
  12. import java.nio.CharBuffer;
  13. import javax.lang.model.element.Modifier;
  14. import javax.lang.model.element.NestingKind;
  15.  
  16. public class SimpleJavaFileObject implements JavaFileObject {
  17.    protected final URI uri;
  18.    protected final JavaFileObject.Kind kind;
  19.  
  20.    protected SimpleJavaFileObject(URI var1, JavaFileObject.Kind var2) {
  21.       var1.getClass();
  22.       var2.getClass();
  23.       if (var1.getPath() == null) {
  24.          throw new IllegalArgumentException("URI must have a path: " + var1);
  25.       } else {
  26.          this.uri = var1;
  27.          this.kind = var2;
  28.       }
  29.    }
  30.  
  31.    public URI toUri() {
  32.       return this.uri;
  33.    }
  34.  
  35.    public String getName() {
  36.       return this.toUri().getPath();
  37.    }
  38.  
  39.    public InputStream openInputStream() throws IOException {
  40.       throw new UnsupportedOperationException();
  41.    }
  42.  
  43.    public OutputStream openOutputStream() throws IOException {
  44.       throw new UnsupportedOperationException();
  45.    }
  46.  
  47.    public Reader openReader(boolean var1) throws IOException {
  48.       CharSequence var2 = this.getCharContent(var1);
  49.       if (var2 == null) {
  50.          throw new UnsupportedOperationException();
  51.       } else {
  52.          if (var2 instanceof CharBuffer) {
  53.             CharBuffer var3 = (CharBuffer)var2;
  54.             if (var3.hasArray()) {
  55.                return new CharArrayReader(var3.array());
  56.             }
  57.          }
  58.  
  59.          return new StringReader(var2.toString());
  60.       }
  61.    }
  62.  
  63.    public CharSequence getCharContent(boolean var1) throws IOException {
  64.       throw new UnsupportedOperationException();
  65.    }
  66.  
  67.    public Writer openWriter() throws IOException {
  68.       return new OutputStreamWriter(this.openOutputStream());
  69.    }
  70.  
  71.    public long getLastModified() {
  72.       return 0L;
  73.    }
  74.  
  75.    public boolean delete() {
  76.       return false;
  77.    }
  78.  
  79.    public JavaFileObject.Kind getKind() {
  80.       return this.kind;
  81.    }
  82.  
  83.    public boolean isNameCompatible(String var1, JavaFileObject.Kind var2) {
  84.       String var3 = var1 + var2.extension;
  85.       return var2.equals(this.getKind()) && (var3.equals(this.toUri().getPath()) || this.toUri().getPath().endsWith("/" + var3));
  86.    }
  87.  
  88.    public NestingKind getNestingKind() {
  89.       return null;
  90.    }
  91.  
  92.    public Modifier getAccessLevel() {
  93.       return null;
  94.    }
  95.  
  96.    public String toString() {
  97.       return this.uri + " from " + this.getClass().getSimpleName();
  98.    }
  99. }
  100.